import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
import qiankun from 'vite-plugin-qiankun'

export default defineConfig({
  base: '/vue-app/',
  plugins: [
    vue(), 
    VueSetupExtend(), 
    // lastCommitPlugin(), 
    // Inspect({
    //   build: true,
    //   outputDir: '.vite-inspect'
    // }),
    qiankun('subVueAPP', { useDevMode: true })
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'), // 设置 `@` 指向 `src` 目录
      // 'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
    }
  },
  server: {
    open: true,
    host: '0.0.0.0', // 设置本地Network
    port: 3001, // 设置本地端口
    proxy: {
      "/api": {
        target: 'http://127.0.0.1:3007', // 本地服务器
        changeOrigin: true,
        secure: false,
        // rewrite: path => path.replace(/^\/api/, '')
      },
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        // additionalData: `@import "@/assets/css/global.less";`
      }
    }
  },
  build: {
    outDir: 'dist/sub-app-vue3'
  }
})
